<?php
if($check->isAdmin()) {
	if ($_POST['addtodo'])
	{
		$todo = $_POST['todo'];
		$priority = $_POST['priority'];
		$percent = $_POST['percent'];
		mysql_query("INSERT INTO todo 
		(todo, priority, percent) VALUES('$todo', '$priority', '$percent') ") 
		or die(mysql_error());
		$result = 'Successfull! Added to todolist.';
	}
	$main = '			
			<table cellpadding="4" cellspacing="1" width="100%">
				<tr>
					<td>
						'.$result.'
						<form method="post" name="addtodo" action="?page=addtodo">

						<strong>Todo:</strong><br />
						<input type="text" name="todo" />
						<br />

						<strong>Priority:</strong><br />
						<input type="text" name="priority" /> (LOW / MEDIUM / HIGH)
						<br />
						
						<strong>Percent:</strong><br />
						<input type="text" name="percent">
						<br />

						<input type="submit" value="Submit" name="addtodo" />
						</form>
					</td>
				</tr>
			</table>';
} else {
	$main = 'You are not adminstrator!';
}
?>